﻿using Quartz;
using Quartz.Impl;
using System;

namespace OnlineMediaAnalyzer
{
    public class TaskScheduler
    {
        public static void Start()
        {
            
            IScheduler scheduler = StdSchedulerFactory.GetDefaultScheduler();
            scheduler.Start();

            IJobDetail job = JobBuilder.Create<ScheduledTask>().Build();

            ITrigger trigger = TriggerBuilder.Create()
                .WithIdentity("trigger1", "group1")
                .WithCronSchedule("* * 0/1 * * ?")
                .Build();

            scheduler.ScheduleJob(job, trigger);
            

            /*
            .WithDailyTimeIntervalSchedule
              (s =>
                 s.WithIntervalInHours(24)
                .OnEveryDay()
                .StartingDailyAt(TimeOfDay.HourAndMinuteOfDay(0, 0))
              )
            .Build();*/
        }
    }
}